package com.tbit.uqbike.client.service.impl;

import com.tbit.uqbike.client.dao.log.UserAdapayLogTempDao;
import com.tbit.uqbike.client.pojo.newEntity.UserAdaPayLog;
import com.tbit.uqbike.client.service.UserAdaPayLogTempService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Objects;

/**
 * 分账临时表操作接口
 *
 * @author <a href="mailto:zhang.zhiliang@tbit.com.cn">Zhang ZhiLiang</a>
 * @version 1.0
 * @see <a href="http://adsl1.tbit.com.cn:21490/pages/viewpage.action?pageId=82182491">订单号规范</a>
 * @since 2024/7/19
 */
@Service
public class UserAdaPayLogTempServiceImpl implements UserAdaPayLogTempService {

    @Resource
    private UserAdapayLogTempDao userAdapayLogTempDao;

    /**
     * 按支付订单号获取 分账详情临时表
     * @param orderNO
     * @return
     */
    @Override
    public List<UserAdaPayLog> getListByOrderNO(String orderNO) {
        if (Objects.isNull(orderNO)){
            return null;
        }
        return userAdapayLogTempDao.selectList(orderNO);
    }

    /**
     * 按支付订单号删除 分账详情临时表
     * @param orderNO
     */
    @Override
    public void deleteByOrderNO(String orderNO) {
        if (Objects.isNull(orderNO)){
            return ;
        }
        userAdapayLogTempDao.delete(orderNO);
    }

    /**
     * 批量插入
     * @param userAdapayLogTempList
     */
    @Override
    public void batchInsert(List<UserAdaPayLog> userAdapayLogTempList) {
        if (userAdapayLogTempList.isEmpty()){
            return ;
        }
        userAdapayLogTempDao.batchInsert(userAdapayLogTempList);
    }
}
